<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="onein" uri="http://www.onein.cn/jsp/taglib"%>
<%@ page import="cn.onein.edu.web.common.base.BaseController" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>找回密码  | 万应教育</title>
<jsp:include page="/WEB-INF/inc/meta.jsp"/>
<link href="<onein:url value="/styles/all.css"/>" type="text/css" rel="stylesheet" />
<script src="<onein:url value="/scripts/json.min.js"/>" type="text/javascript"></script>
<script src="<onein:url value="/scripts/jquery.js"/>" type="text/javascript"></script>
<script type="text/javascript">
function forget(url){
	var success = true;
	
	if($("#userName").val() == ""){
        document.getElementById("userNameErr").style.display = ""; // 显示
        success = false;
    }
	
	if(success == true){
		$.getJSON(url, {
			userName : $("#userName").val()
		}, function(action) {
			if(action.flag == "ERROR"){
				alert("服务器错误,请稍后再试.");
			}else if(action.flag == "VALIDATE_NOTEXIST_KEY"){
				alert("该用户名或邮箱不存在，请检查！");
			}else {
				alert("新密码已经发送到您的邮箱,请查收！");
				var loginUrl = url.replace("doForgetPassword.json","login");
				window.location.href = loginUrl;
			}
		});
	}
}

function loseblur(type){
    document.getElementById(type).style.display = "none"; // 隐藏
    
    if("userNameErr" == type){
        if($("#userName").val() == ""){
        	document.getElementById(type).style.display = ""; // 显示
        }
    }

  }
</script>
</head>

<body>
    <jsp:include page="/WEB-INF/inc/header.jsp"/>
    <jsp:include page="/WEB-INF/inc/menu.jsp"/>
<form id="forgetpasswordForm" action="" method="post">
    <div id="bodyWrap">
      <h2 style="margin:10px 0 0 75px;font-size:14px">找回密码</h2>
      <div class="regSelectAgesSelected">
        <div style="margin-top:15px;font-size:14px;color:#333">
            <span>请输入您的登陆邮箱或用户名，新密码将会发送到您的注册邮箱中。</span>
        </div>
        <ul class="regTextWrap">
            <li class="regTh" style="margin-left:177px;">邮箱/用户名:</li>
            <li><input name="userName" id="userName" type="text" value="${userName}" class="textBox" onblur="loseblur('userNameErr')" maxlength="50"/></li>
            <li class="regSatu" id="userNameErr" style="display:none;">邮箱/用户名不能为空.</li>
        </ul>
        <div  >
          <ul class="regTextWrap">
            <li>
               <div style="margin-left:300px;margin-top:10px;">
                     <a href="#" onclick="javascript:forget('<onein:url value="/doForgetPassword.json" />');" class="botton1"><span style="font-size:14px;">提  交</span></a>
                </div>
            </li>
          </ul>
          
         
          </div>
        <div class="ca"></div> 
      </div>
     <div class="ca"></div>
</div>
</form>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<jsp:include page="/WEB-INF/inc/footer.jsp"/>
</body>
</html>
